package cn.yuanqiao.archive.appManager.domain;

import cn.yuanqiao.common.annotation.Excel;
import cn.yuanqiao.common.annotation.IdAnnotation;
import cn.yuanqiao.common.exception.ServiceException;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.utils.SecurityUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotNull;

/**
 * manage对象 YQDA_CODERULE_MODEL
 *
 * @author yuanqiao
 * @date 2023-06-14
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
public class TenantCodeRule extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    public static final String BIGTABLENAME = "_CODERULE";

    public TenantCodeRule() {
        String tenantCode = SecurityUtils.getTenantCode();
        if(StringUtils.isEmpty(tenantCode)){
        //    throw new ServiceException("tenantCode is null");
        }else {
            this.tableName = tenantCode.toUpperCase()+BIGTABLENAME;
        }
    }

    private String tableName;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    /** 主键 */
    @IdAnnotation
    @JsonFormat(shape = JsonFormat.Shape.STRING)//转化成string传到前端
    private Long Id;

    /** 对应的门类模板id */
    @NotNull(message = "请选择门类模板")
    @JsonFormat(shape = JsonFormat.Shape.STRING)//转化成string传到前端
    private Long categoryModelId;

    /** 规则名称 */
    @NotNull(message = "请输入规则名称")
    @Excel(name = "规则名称")
    private String name;

    /** 卷层存储字段 */
    private String vColumnname;

    /** 排序 */
    @Excel(name = "排序")
    private String orderStr;

    /** 开始时间 */
    @NotNull(message = "请输入开始时间")
    @Excel(name = "开始时间")
    private Integer starttime;

    /** 截止时间 */
    @NotNull(message = "请输入截止时间")
    @Excel(name = "截止时间")
    private Integer endtime;

    /** 创建人id */
    @JsonFormat(shape = JsonFormat.Shape.STRING)//转化成string传到前端
    private Long creatorId;

    /** 创建人 */
    @Excel(name = "创建人")
    private String creator;

    private String create_time;

    /** 件层存储字段 */
    private String fColumnname;

    /** 电子文件层存储字段 */
    private String eColumnname;

    /** 默认规则 */
    private Integer isMoren;

    public Integer getIsMoren() {
        return isMoren;
    }

    public void setIsMoren(Integer isMoren) {
        this.isMoren = isMoren;
    }

    public String getCreate_time() {
        return create_time;
    }

    public void setCreate_time(String create_time) {
        this.create_time = create_time;
    }

    public void setId(Long Id)
    {
        this.Id = Id;
    }

    public Long getId()
    {
        return Id;
    }
    public void setCategoryModelId(Long categoryModelId)
    {
        this.categoryModelId = categoryModelId;
    }

    public Long getCategoryModelId()
    {
        return categoryModelId;
    }
    public void setName(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return name;
    }
    public void setvColumnname(String vColumnname)
    {
        this.vColumnname = vColumnname;
    }

    public String getvColumnname()
    {
        return vColumnname;
    }
    public void setOrderStr(String orderStr)
    {
        this.orderStr = orderStr;
    }

    public String getOrderStr()
    {
        return orderStr;
    }

    public Integer getStarttime() {
        return starttime;
    }

    public void setStarttime(Integer starttime) {
        this.starttime = starttime;
    }

    public Integer getEndtime() {
        return endtime;
    }

    public void setEndtime(Integer endtime) {
        this.endtime = endtime;
    }

    public void setCreatorId(Long creatorId)
    {
        this.creatorId = creatorId;
    }

    public Long getCreatorId()
    {
        return creatorId;
    }
    public void setCreator(String creator)
    {
        this.creator = creator;
    }

    public String getCreator()
    {
        return creator;
    }
    public void setfColumnname(String fColumnname)
    {
        this.fColumnname = fColumnname;
    }

    public String getfColumnname()
    {
        return fColumnname;
    }
    public void seteColumnname(String eColumnname)
    {
        this.eColumnname = eColumnname;
    }

    public String geteColumnname()
    {
        return eColumnname;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("Id", getId())
            .append("categoryModelId", getCategoryModelId())
            .append("name", getName())
            .append("vColumnname", getvColumnname())
            .append("orderStr", getOrderStr())
            .append("starttime", getStarttime())
            .append("endtime", getEndtime())
            .append("creatorId", getCreatorId())
            .append("creator", getCreator())
            .append("createTime", getCreateTime())
            .append("fColumnname", getfColumnname())
            .append("eColumnname", geteColumnname())
            .toString();
    }
}
